<?php

class Client {
    protected $name,
              $order,
              $inn,
              $phone;

    function __construct($name,$inn,$phone,$order=null) {
        $this->name = $name;
        $this->inn = $inn;
        $this->phone = $phone;

        if (is_null($order)) {
            $this->order = rand(100,1000);
        } else {
            $this->order = $order;
        }
    }

    function __get($name) {
        return $this->{$name};
    }

    function putMoney($sum) {
        if (!empty($sum)) {
            return Bank::getInstance()->putMoney($sum,$this->order);
        }
        return FALSE;
    }

    function getMoney($sum) {
        if (!empty($sum)) {
            return Bank::getInstance()->getMoney($sum,$this->order);
        }
        return FALSE;
    }

    function getClinetInfo() {
        return array(
            "name" => $this->name,
            "inn" => $this->inn,
            "phone" => $this->phone,
            "order" => $this->order
        );
    }
}